import { defineStore } from "pinia";
import { ref } from "vue";
import { userType } from "../ts/user";

export const useUserStore = defineStore("user", () => {
  const user = ref<userType | null>(null);

  const clear = () => {
    user.value = null;
  };

  const setUser = (userData: userType) => {
    user.value = userData;
  };

  const getUser = () => {
    return user.value;
  };
  return {
    user,
    clear,
    setUser,
    getUser,
  };
});
